#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
void *threadpt1(void *arg){
    char *name = (char *)arg;
    printf("pt1的线程号%d,name=%s\n",gettid(),name);
    return "helloGEM";
}
void *threadpt2(void *arg){

    int age = *(int *)arg;
    printf("pt2的线程号%dsize=%d\n",gettid(),age);
    static int val = 20;
    return &val;

}

int main(int argc, char const *argv[])
{
    printf("main函数开始%d\n",gettid());
    pthread_t pt1,pt2;
    pthread_create(&pt1,NULL,threadpt1,"ljt");
    int age = 18;
    pthread_create(&pt2,NULL,threadpt2,&age);

    char *gem;
    int *data;
    pthread_join(pt1,(void*)&gem);
    pthread_join(pt2,(void **)&data);
    printf("pt1的返回值%s\n",gem);
    printf("pt2的返回值%d\n",*data);
    printf("main函数结束%d\n",gettid());

    return 0;
}
